package close.mazegame.input;

import close.mazegame.InputHandler;

import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.Vector2;

public abstract class KeyboardInput<T extends Enum<T>> extends BasicInput<T> implements InputProcessor {
	
	protected Vector2 pointer = new Vector2();
	protected boolean mouseButton[] = new boolean[3];
	
	public KeyboardInput() {
		for(int i = 0; i < mouseButton.length; i++){
			mouseButton[i] = false;
		}
		InputHandler.addInputProcessor(this);
	}
	
	@Override
	public void dispose() {
		InputHandler.removeInputProcessor(this);
	}

	@Override
	public boolean keyDown(int keycode) {
		pressKey(keycode);
		return false;
	}

	@Override
	public boolean keyUp(int keycode) {
		releaseKey(keycode);
		return false;
	}

	@Override
	public boolean keyTyped(char character) {
		return false;
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		return false;
	}

	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		return false;
	}

	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {
		this.pointer.x = screenX;
		this.pointer.y = screenY;
		return false;
	}

	@Override
	public boolean mouseMoved(int screenX, int screenY) {
		pointer.x = screenX;
		pointer.y = screenY;
		return false;
	}

	@Override
	public boolean scrolled(int amount) {
		return false;
	}

}
